function czyObslugujeMaxSize() { 
	var navName = navigator.appName; // nazwa 
	var brVer = navigator.userAgent; 	
	
	if(!(navName == 'Microsoft Internet Explorer')) return true;
	
	// sprawdzamy wersje IE
	var i = brVer.indexOf('MSIE');
	var s = brVer.substr(i + 5, brVer.length);
	var verNum = s.substr(0, 1); // numer wersji IE
	if(parseInt(verNum) < 7) 
		return false;
		
	return true;	
}

function readCookie(cookieName){
   var searchName = cookieName + "="
   var cookies = document.cookie
   var start = cookies.indexOf(cookieName)
   if (start == -1){ // cookie not found 
     return ""
     }
   start += searchName.length //start of the cookie data
   var end = cookies.indexOf(";", start)
   if (end == -1){
     end = cookies.length
     }
   return cookies.substring(start, end)
   }


function getCookieExpireDate(noDays){
  var today = new Date()
  var expr = new Date(today.getTime()+noDays*24*60*60*1000)
  return  expr.toGMTString()
  }
    
  
function makeCookie(name, data, noDays){
  var cookieStr = name + "="+ data
  if (makeCookie.arguments.length > 2){
    cookieStr += "; expires=" + getCookieExpireDate(noDays)
    }
  document.cookie = cookieStr
  }


function stylDomyslny() {
	document.styleSheets[0].disabled = true;
	document.styleSheets[1].disabled = true;
	document.styleSheets[2].disabled = true;
	document.styleSheets[3].disabled = true;
	
	var styl = readCookie('styl');
	
	if(styl == "")  // jesli cookies nie zostalo ustawione
		if(czyObslugujeMaxSize()) {
			document.styleSheets[0].disabled = false;
			makeCookie("styl", "styl1", 30);  
		}
		else {
			document.styleSheets[2].disabled = false;	
			makeCookie("styl", "stylIE1", 30); 
		} 
	else
		switch(styl) {
			case 'styl1':
				document.styleSheets[0].disabled = false;				
				break;
			
			case 'styl2':
				document.styleSheets[1].disabled = false;
				break;
			
			case 'stylIE1':
				document.styleSheets[2].disabled = false;
				break;
			
			case 'stylIE2':
				document.styleSheets[3].disabled = false;
				break;
			
			default:
				document.styleSheets[0].disabled = false;		
		}
}

stylDomyslny();


function styl1 () {	
	var styl = readCookie('styl');
	
	if(czyObslugujeMaxSize()) 
		if(styl != 'styl1') {			
			document.styleSheets[0].disabled=false;
			document.styleSheets[1].disabled=true;	

			makeCookie("styl", "styl1", 30); 
			return;
		}
		else return; // jesli juz jest styl1 to nic nie robi
	
	if(styl != 'stylIE1') {	
		document.styleSheets[2].disabled=false;
		document.styleSheets[3].disabled=true;	

		makeCookie("styl", "stylIE1", 30); 		
	}
	 

}


function styl2() {	
	var styl = readCookie('styl');
	
	if(czyObslugujeMaxSize()) 
		if(styl != 'styl2') {	
		
			document.styleSheets[0].disabled=true;
			document.styleSheets[1].disabled=false;		

			makeCookie("styl", "styl2", 30);  
			return;
		}
		else return; // jesli juz jest styl2 to nic nie rob
	
	if(styl != 'stylIE2') {		
		document.styleSheets[2].disabled=true;
		document.styleSheets[3].disabled=false;	

		makeCookie("styl", "stylIE2", 30);  
	}
}